package work.jame.blog.framework.utils;

import java.time.LocalDateTime;

/**
 * @author : Jame
 * @date : 2023-05-27 08:56
 **/
public class DateTimeUtils {


    /**
     * 获取今天开始时间
     * @return LocalDateTime 今天开始时间
     */
    public static LocalDateTime getTodayStartTime(){
        LocalDateTime now = LocalDateTime.now();
        int year = now.getYear();
        int month = now.getMonthValue();
        int day = now.getDayOfMonth();
        return  LocalDateTime.of(year, month, day, 0, 0, 0);
    }

    /**
     * 获取今天结束时间
     * @return LocalDateTime 今天结束时间
     */
    public static LocalDateTime getTodayEndTime(){
        LocalDateTime now = LocalDateTime.now();
        int year = now.getYear();
        int month = now.getMonthValue();
        int day = now.getDayOfMonth();
        return  LocalDateTime.of(year, month, day, 23, 59, 59);
    }


}
